package o;

import com.huawei.appgallery.agwebview.whitelist.WapDomainInfo;
import com.huawei.appgallery.jsonkit.api.JsonBean;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;

public abstract class bbb {
    public static void ˋ(List<WapDomainInfo> list, long j) {
        String ॱ = ॱ(list);
        eui o_eui = new eui("wap_domaininfo_sp");
        o_eui.ˏ("wap_domaininfo_list_new", ॱ);
        o_eui.ˎ("wap_domaininfo_list_updatetime_new", j);
    }

    public static List<WapDomainInfo> ˊ() {
        String ˊ = new eui("wap_domaininfo_sp").ˊ("wap_domaininfo_list_new", "");
        if (dof.ˋ(ˊ)) {
            return null;
        }
        return ˎ(ˊ);
    }

    public static long ॱ() {
        return new eui("wap_domaininfo_sp").ॱ("wap_domaininfo_list_updatetime_new", 0);
    }

    public static String ˏ() {
        return new eui("wap_domaininfo_sp").ॱ("wap_controlMore_version_new", null);
    }

    public static void ˊ(String str) {
        new eui("wap_domaininfo_sp").ˋ("wap_controlMore_version_new", str);
    }

    private static List<WapDomainInfo> ˎ(String str) {
        if (!dof.ˋ(str)) {
            List<WapDomainInfo> arrayList = new ArrayList();
            try {
                JSONArray jSONArray = new JSONArray(str);
                int length = jSONArray.length();
                for (int i = 0; i < length; i++) {
                    String string = jSONArray.getString(i);
                    if (dof.ᐝ(string)) {
                        WapDomainInfo wapDomainInfo = new WapDomainInfo();
                        wapDomainInfo.fromJson(new JSONObject(string));
                        string = wapDomainInfo.ˊ();
                        if (!dof.ˋ(string)) {
                            wapDomainInfo.ˊ(string);
                            arrayList.add(wapDomainInfo);
                        }
                    }
                }
                return arrayList;
            } catch (Exception e) {
                azh.ˏ.ˏ("WapDomainInfoSp", "fromJsonArrayStr JSONException");
            }
        }
        return null;
    }

    private static <T extends JsonBean> String ॱ(List<T> list) {
        if (CollectCheck.isEmpty((List) list)) {
            return "";
        }
        String obj = list.toString();
        if (obj.length() < 2) {
            return "";
        }
        return obj;
    }
}
